package com.uam.common.handler;


import com.uam.common.config.UAMConfig;
import com.uam.common.constant.CST;
import com.uam.common.exception.UamException;
import com.uam.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @author Administrator
 * @title: ApplicationRunnerImpl
 * @projectName base-java
 * @description: 项目启动执行方法
 */
@Component
@Slf4j
public class ApplicationRunnerImpl implements ApplicationRunner {

    @Autowired
    private UAMConfig uamConfig;
    /**
     * @param args
     * @return void
     * @description: 启动缓存数据
     */
    @Override
    public void run(ApplicationArguments args) {
        CST.URL=uamConfig.getRouteUrl();
        if(StringUtils.isBlank(CST.URL)){
            throw  new UamException("获取航线地址错误");
        }
        log.info("航线url：{}", CST.URL);
        log.info("==================== UAM启动完成 ====================");
    }

}

